const express = require('express');
const app = express();

app.listen(3000, () => {
    console.log('服务器已开启');
})

//中间件不带路径
app.use((req, res, next) => {
    res.send('中间件不受请求方式影响，受路径影响');
    
    // 中间件
    req.haha = new Date();
    next();
})

//中间件带路径
app.use((req, res) => {
    res.send('中间件不受请求方式影响，受路径影响');
})

app.get('/get', (req, res) => {
    res.send('get' + req.haha)
})

app.post('/post', (req, res) => {
    res.send('post' + req.haha)
})

app.delete('/delete', (req, res) => {
    res.send('delete' + req.haha)
})

app.put('/put', (req, res) => {
    res.send('put' + req.haha)
})





